package com.vint.mi;

/**
 * 1. easy,done
 * 2. 找出唯一只出现一次的数，其它的出现两次
 */
public class Mi111 {
	private static String solution(String line) {
		int[] map = new int[26];
		int max = 0;
		int min = line.length();
		for(char c : line.toCharArray()){
			map[c-'a'] ++;
		}
		for(int i : map) {
			if(i==0) continue;
			if(i>max)max=i;
			if(i<min)min=i;
		}
		if(max==min&&max-min<=1)return "YES";
		int maxs = 0;
		int mins = 0;
		for(int i : map) {
			if(i==max)maxs++;
			if(i==min)mins++;
		}
		if(mins==1)return "YES";
		if(max-min<0||max-min>=2) return "NO";
		if(maxs==1&&max-min==1)return "YES";
		return "NO";
	}
	public static void main(String[] args){
		String src = "oabbfywpwwqafwbfyuiiuyuioppolll";
		System.out.println(solution(src));
	}
}
